package com.control.qct.businesssteward.adapter;

import android.graphics.Color;
import android.support.annotation.Nullable;

import com.control.qct.businesssteward.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by Administrator on 2017/12/29 0029.
 */

public class CalendarViewAdapter extends BaseQuickAdapter<Integer, BaseViewHolder> {
    private int mPosition;

    public CalendarViewAdapter(@Nullable List<Integer> data) {
        super(R.layout.custom_day, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, Integer item) {
        holder.setText(R.id.tv_date, item + "");
        holder.setGone(R.id.selected_background, mPosition == holder.getAdapterPosition());
        holder.setTextColor(R.id.tv_date, mPosition == holder.getAdapterPosition() ? Color.parseColor("#ffffff") :
                Color.parseColor("#949494"));
    }

    public void setPosition(int position) {
        mPosition = position;
        notifyDataSetChanged();
    }
}
